//
//  YKPerformanceItemCell.m
//  YunKang
//
//  Created by leoking870 on 2017/10/2.
//  Copyright © 2017年 leoking870. All rights reserved.
//

#import "YKPerformanceItemCell.h"
#import "YKDashView.h"
@interface YKPerformanceItemCell ()
@property (weak, nonatomic) IBOutlet UILabel *orderNoLabel;
@property (weak, nonatomic) IBOutlet UILabel *productNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *purchaseCountLabel;
@property (weak, nonatomic) IBOutlet UILabel *scoreLabel;
@end


@implementation YKPerformanceItemCell

@dynamic tableViewItem;

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)cellLoadSubViews {
    [super cellLoadSubViews];
    
    self.orderNoLabel.tf_weight = 1;
    self.productNameLabel.tf_weight = 2;
    self.purchaseCountLabel.tf_weight = 1;
    self.scoreLabel.tf_weight = 1;
    self.productNameLabel.textAlignment = NSTextAlignmentCenter;
    self.purchaseCountLabel.textAlignment = NSTextAlignmentCenter;
    self.scoreLabel.textAlignment = NSTextAlignmentCenter;
    
    [@[self.orderNoLabel, self.productNameLabel,  self.purchaseCountLabel,self.scoreLabel] mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.top.equalTo(self.contentView.mas_top).offset(11);
    }];
    
    [@[self.orderNoLabel, self.productNameLabel,  self.purchaseCountLabel,self.scoreLabel] mas_alignWeightlyAlongAxis:MASAxisTypeHorizontal
                                                                                                           fixedSpace:@2
                                                                                                            leadingTo:self.contentView.mas_leading
                                                                                                            leadSpace:13
                                                                                                           trailingTo:self.contentView.mas_trailing
                                                                                                            tailSpace:13];
    
    YKDashView* dashView = [[YKDashView alloc]init];
    dashView.lineWidth = .5f;
    dashView.lineColor = [UIColor tf_colorWithHexString:@"#d4d4d4"];
    dashView.dashLineLength = 3;
    [self addSubview:dashView];
    [dashView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.bottom.trailing.equalTo(self);
        make.height.mas_equalTo(1);
    }];
    self.scoreLabel.textColor = TFSTYLE(buttonEnableBackgroundColor);
}

- (void)cellWillAppear {
    [super cellWillAppear];
    self.orderNoLabel.text = self.tableViewItem.model.CSOCODE;
    self.productNameLabel.text = self.tableViewItem.model.CINV_NAME;
    self.purchaseCountLabel.text = self.tableViewItem.model.CINV_NUM;
    self.scoreLabel.text = self.tableViewItem.model.POINTS;
}

@end
